<?php

namespace app\common\model;

use think\Model;

class PayOrder extends Model
{
    // 表名
    protected $name = 'pay_order';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'type_text',
        'status_text',
    ];

    public function getTypeList()
    {
        return ['qqpay' => __('QQ钱包'),'wxpay' => __('微信'),'alipay' => __('支付宝'),'tenpay' => __('财付通')];
    }     


    public function getTypeTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['type'];
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    
    public function getStatusList()
    {
        return ['1' => __('已支付'),'0' => __('未支付')];
    }     


    public function getStatusTextAttr($value, $data)
    {        
        $value = $value ? $value : $data['status'];
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }
    







}
